package written.test;

import java.util.Scanner;

/**
 * @Author: Dang Qi
 * @Date: 2021/4/2  19:15
 * @Description:
 */
public class AlibabaQ2 {
    public static void main(String[] args) {
        Scanner sc  = new Scanner(System.in);
        int T = sc.nextInt();
        for(int i = 0; i < T; i++){
            int n = sc.nextInt();
            System.out.println(cal(n));
        }
    }
    public static double cal(int n){
        if(n>10000) return 1.0;
        int N = (int)Math.ceil(n*1.0/25);
        double[][] dp = new double[N+1][N+1];
        dp[0][0] = 0.5;
        for(int i = 1; i < N+1; i++){
            dp[i][0] = 0.0;
        }
        for(int j = 1; j < N+1; j++){
            dp[0][j] = 1.0;
        }
        for(int i=1; i <= N; i++){
            for(int j=1; j < N+1; j++){

                dp[i][j] += dp[i-4>=0?i-4:0][j] +
                        dp[i-3>=0?i-3:0][j-1>=0?j-1:0] +
                        dp[i-2>=0?i-2:0][j-2>=0?j-2:0] +
                        dp[i-1>=0?i-1:0][j-3>=0?j-3:0];
                dp[i][j] *= 0.25;
            }
        }
        return dp[N][N];
    }

}
